<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body> 
     <!-- 需求：用户需求点击跳转，如果不点击，则跳转到百度，有倒计时 -->
        
        <button><a href="https://auth.alipay.com/login/homeB.htm">支付成功，等待<span id="time">5</span>秒跳转</a> </button>
       
        <script>
            var btn = document.querySelector("button");     
            var time = document.querySelector("#time");   
            var timer = 5;      
            btn.addEventListener("click",function(){
                location.href = "https://auth.alipay.com/login/homeB.htm";
            })
            var timer = setInterval(function(){ 
                time.innerHTML = timer;
                timer--;
                if(timer<0){
                    clearInterval(timer);
                    location.href = "https://auth.alipay.com/login/homeB.htm";
                }   
            }   ,1000)      
        </script>

</body>
</html>